home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / mkmf / mkmf.bigcmdtop < prev    next >
Encoding:
Text File  |  1991-04-11  |  1.9 KB  |  73 lines

  1. #!/sprite/cmds/csh -f
  2. #
  3. # A script to generate (or regenerate) a Makefile for the topmost directory
  4. # of a library that is divided up into subdirectories.  This direcctory is
  5. # little more than a container for lots of subdirectories that have the
  6. # interesting stuff in them.
  7. #
  8. # We assume we were invoked from mkmf.
  9. #
  10. # Parameters passed in from mkmf as environment variables:
  11. #    MKMFDIR        directory containing prototype makefiles
  12. #    MAKEFILE    name of makefile to create
  13. #    MACHINES    list of machine names (e.g. "sun2 sun3"), for
  14. #            which there are machine-dependent subdirectories
  15. #            (sun3.md, spur.md, etc.) of this directory.
  16. #    SUBTYPE        what sort of library this is:  "sprite", "x", etc.
  17. #
  18. # Several of these environment variables must be copied to local shell
  19. # variables before use, because shell variables can be used in some places
  20. # where environment variables can't.
  21. #
  22. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmdtop,v 1.8 91/04/11 12:53:36 kupfer Exp $ (SPRITE) Berkeley
  23. #
  24.  
  25. #
  26. # Argument processing.  (Generalized form, even though just one flag so far.)
  27. #
  28. while ($#argv >= 1)
  29.     if ("$1" == '-x') then
  30.     set echo
  31.     endif
  32.     shift
  33. end
  34.  
  35. set subtype=$SUBTYPE
  36. set name=$cwd:t
  37. set machines=($MACHINES)
  38. set makefile=$MAKEFILE
  39. set distdir=($DISTDIR)
  40.  
  41. if (-e $makefile.proto) then
  42.     set proto=$makefile.proto
  43. else
  44.     set proto="${MKMFDIR}/Makefile.bigcmdtop"
  45. endif
  46.  
  47. echo "Generating $makefile for $cwd using $proto"
  48.  
  49. set subDirs="`find * -type d ! -name \*.md ! -name RCS -prune -print`"
  50.  
  51. if ("$subDirs" == "") then
  52.     echo "No subdirectories found."
  53. endif
  54.  
  55. set nonomatch
  56. set manPages = (*.man)
  57. if ("$manPages" == "*.man") then
  58.     set manPages = ()
  59. endif
  60. unset nonomatch
  61.  
  62. cat $proto | sed \
  63.     -e "s,@(DATE),`date`,g" \
  64.     -e "s,@(MACHINES),$machines,g" \
  65.     -e "s,@(MAKEFILE),$makefile,g" \
  66.     -e "s,@(MANPAGES),$manPages,g" \
  67.     -e "s,@(NAME),$name,g" \
  68.     -e "s,@(SUBDIRS),$subDirs,g" \
  69.     -e "s,@(TEMPLATE),$proto,g" \
  70.     -e "s,@(TYPE),$subtype,g" \
  71.     -e "s,@(DISTDIR),$distdir,g" \
  72.     > $makefile
  73.